package com.auth.Sercurity.demoList;

import lombok.Data;

/**
 * @author hujian
 * @version 1.0
 * @description: 策略moshi
 * @date 2022/2/18 15:24
 */
public  class ObjectDemo1 {

    public static void main(String[] args) {
        Kitchen kitchen = new Kitchen();
        kitchen.setCooking(new CookingA());
        kitchen.cookingMethos();
        System.out.println("================");
        kitchen.setCooking(new CookingB());
        kitchen.cookingMethos();
    }

//    环境
    @Data
    static  class Kitchen{
        private Cooking cooking;

        public void cookingMethos(){
            cooking.cookingMethod();
        }
}
//    抽象策略
    interface Cooking{
        void cookingMethod();
}
//    具体策略
//    策略1
static class  CookingA implements Cooking{

    @Override
    public void cookingMethod() {
        System.out.println("红烧");
    }
}
//      策略2
static  class CookingB implements Cooking{

        @Override
        public void cookingMethod() {
            System.out.println("清蒸");
        }
    }
}
